appName="testdockerboot"
word="1"
echo "$word"
word=`docker ps -a -q --no-trunc --filter name=^/"$appName"$`
echo "$word"
if [ -z "$word" ];
then
    echo "当前不存在该容器，直接进行启动该操作-------------------------------------"
elif [ -n "$word" ];
then
    echo "当前已存在容器，停止并移除该容器-------------------------------------"
    docker stop "$word"
    docker rm "$word"
elif [ "$word" == "1" ];
then
    echo "查询的信息有误，执行默认操作-------------------------------------"
    docker stop "$word"
    docker rm "$word"
fi
cd  /usr/bin/
ln -s /usr/libexec/docker/docker-proxy-current /usr/bin/docker-proxy
#重启docker 必要时 重新发布镜像和容器
sudo systemctl daemon-reload
systemctl restart docker
#根据当前目录下默认的dockerfile的设置将jar打包到docker中成为镜像images
docker build -t testdockerboot:latest .
docker run -p 9093:9091 -d --name testdockerboot testdockerboot:latest
# 打印当前容器

docker ps -a | grep $appName
echo "star service success!"
